package com.ruoyi.api.user;

import java.util.Date;
import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruoyi.api.user.requestVo.ProblemSaveRequestVo;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.user.domain.Problem;
import com.ruoyi.user.service.IProblemService;

import io.swagger.annotations.ApiOperation;

/**
 * 问题反馈 信息操作处理
 * 
 * @author ruoyi
 * @date 2018-12-23
 */
@Controller
@RequestMapping("/api/problem")
public class ApiProblemController extends BaseController
{
    private String prefix = "problem";
	
	@Autowired
	private IProblemService problemService;
	
	/**
	 * 新增保存问题反馈
	 */
	@Log(title = "问题反馈", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	@ApiOperation(value="新增保存问题反馈", notes="新增保存问题反馈",produces = "application/json")
	public HashMap<String, Object> addSave(@RequestBody ProblemSaveRequestVo problemSaveRequestVo)
	{		
		Problem problem = new Problem();
		problem.setContent(problemSaveRequestVo.getContent());
		problem.setCreateTime(new Date());
		int re = problemService.insertProblem(problem);
		if(re>0){
			return successApp("");
		}else{
			return errorApp("prb-0001","新增保存问题反馈失败");
		}
	}

}
